\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q: I am using the function
\b NXGetNamedObject
\b0 (const char
\b
\b0\i * aname
\b\i0 ,
\b0 id
\i owner
\i0 ) to find the
\b id
\b0 of my NXBrowser object.
\fc1\cf1 My main program containing the
\b loadNibSection:owner:
\b0 was created by InterfaceBuilder and had NXApp in the
\b owner:
\b0 argument. However, passing NXApp as the owner always returns a nil
\b id
\b0 . What am I doing wrong?\
\
A: By default, InterfaceBuilder assigns the Application object (NXApp) as the owner of a Window, and a View's Window as the owner of that View. Since NXBrowser is a subclass of View, you must use the NXBrowser's Window id instead of NXApp as owner in the function
\b NXGetNamedObject()
\b0 . \
\
Below is a code snippet for illustration:\
\
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f1\fs24\fc1\cf1 id myWindow, myBrowser;\
\f0\fs28 Note that named objects are a big performance loser because of the memory it takes to keep track of all the names of the objects. For this reason, we would recommend that you use
\b loadNibSection
\b0\i :owner
\b\i0 :withNames:
\b0\i NO
\i0 when loading in nib files. Try to use outlets instead of named objects whenever possible.\